﻿CREATE PROCEDURE [acms].[User_GetFromLoginKey]
	@Key uniqueidentifier,
	@LastAccessed Datetime
AS
	Update UserLoginKeys Set LastAccessed = @LastAccessed Where [Key] = @Key

	SELECT a.*
	From User_View a inner join UserLoginKeys b on a.Id = b.UserId
	Where 
		b.[Key] = @Key
RETURN 0;